# -*- coding:utf-8 -*-


class FinanceManageSql(object):
    """用户管理相关SQL"""

    # 用户登录
    USER_LOGIN = "SELECT * FROM user_info WHERE user_name = %s AND user_passwd = %s AND user_status = 0"

    # 财务管理列表
    FINANCE_LIST = "SELECT finance_task_name, finance_task_status, finance_task_header,  finance_plan_start, " \
                   "finance_plan_end, finance_actu_start, finance_actu_end FROM financemanage "

    # 新增任务
    ADD_FINANCE = "INSERT INTO financemanage(finance_task_name, finance_task_status, finance_task_describe, " \
                  "finance_task_header, finance_task_member, finance_task_present, finance_create_user, " \
                  "finance_create_date,  finance_plan_start, finance_plan_end) " \
                  "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"

    # 开启任务、结束任务
    START_FINANCE = "UPDATE  financemanage SET finance_task_status = %s WHERE id = %s "

    # 任务详情
    FINANCE_INFO = "SELECT * FROM financemanage WHERE id = %s "

    # 任务日报
    FINANCE_REPORT = "SELECT report_info, report_creat_time, ui.user_name FROM report " \
                     "LEFT JOIN user_info ui " \
                     "ON report.report_user_id = ui.id " \
                     "WHERE report_classfy_id = %s " \
                     "AND report.id = %s "

    # 添加任务日报
    ADD_FINANCE_REPORT = "INSERT INTO report(finance_id, report_classfy_id, report_info, " \
                          "report_user_id, report_creat_time) VALUES (%s, %s, %s, %s, %s)"

    # 修改任务日报
    UPDATE_FINANCE_REPORT = "UPDATE financemanage SET report_info = %s " \
                            "WHERE finance_id = %s AND report_classfy_id = %s "

    # 修改任务内容
    EDIT_TASK = "UPDATE financemanage SET finance_task_name = %s, finance_task_describe = %s, " \
                "finance_task_header = %s, finance_task_member = %s, finance_task_present = %s, " \
                "finance_plan_start = %s, finance_plan_end = %s WHERE id = %s "
